<template>
	<view class="cu-custom" :style="[{height:CustomBar + 'px'}]">
		<view class="cu-bar fixed flex-zdy" :style="style">
			<view class="flex1">
				<slot name="content"></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar + 5
			};
		},
		name: 'cu-custom',
		computed: {
			style() {
				var StatusBar = this.StatusBar;
				var CustomBar = this.CustomBar;
				var bgImage = this.bgImage;
				var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
				if (this.bgColor) {
					style = `${style}background-color:${this.bgColor};`;
				}
				if (this.bgImage) {
					style = `${style}background-image:url(${bgImage});`;
				}
				return style
			}
		},
		props: {
			bgColor: {
				type: String,
				default: ''
			},
			isBack: {
				type: [Boolean, String],
				default: false
			},
			bgImage: {
				type: String,
				default: ''
			},
		},
		methods: {
			BackPage() {
				uni.navigateBack({
					delta: 1
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cu-custom {
		display: block;
		position: fixed;
		z-index: 99999;
	}

	.flex-zdy {
		display: flex;
		align-items: center;
	}

	.flex1 {
		flex: 1;
	}

	.cu-custom .cu-bar .content {
		width: calc(100% - 440upx);
	}

	/* #ifdef MP-ALIPAY */
	.cu-custom .cu-bar .action .cuIcon-back {
		opacity: 0;
	}

	/* #endif */

	.cu-custom .cu-bar .content image {
		height: 60upx;
		width: 240upx;
	}

	.cu-custom .cu-bar {
		min-height: 0px;
		/* #ifdef MP-WEIXIN */
		padding-right: 220upx;
		/* #endif */
		/* #ifdef MP-ALIPAY */
		padding-right: 150upx;
		/* #endif */
		box-shadow: 0upx 0upx 0upx;
		z-index: 9999;
	}

	.cu-custom .cu-bar .border-custom {
		position: relative;
		background: rgba(0, 0, 0, 0.15);
		border-radius: 1000upx;
		height: 30px;
	}

	.cu-custom .cu-bar .border-custom::after {
		content: " ";
		width: 200%;
		height: 200%;
		position: absolute;
		top: 0;
		left: 0;
		border-radius: inherit;
		transform: scale(0.5);
		transform-origin: 0 0;
		pointer-events: none;
		box-sizing: border-box;
		border: 1upx solid #ffffff;
		opacity: 0.5;
	}

	.cu-custom .cu-bar .border-custom::before {
		content: " ";
		width: 1upx;
		height: 110%;
		position: absolute;
		top: 22.5%;
		left: 0;
		right: 0;
		margin: auto;
		transform: scale(0.5);
		transform-origin: 0 0;
		pointer-events: none;
		box-sizing: border-box;
		opacity: 0.6;
		background-color: #ffffff;
	}

	.cu-custom .cu-bar .border-custom text {
		display: block;
		flex: 1;
		margin: auto !important;
		text-align: center;
		font-size: 34upx;
	}
</style>
